'use strict';

var points = "-0.51266,-31.06668 26.64821,-15.97731 27.16086,15.08936 181.2013,171.00377 -26.64821,15.97731 -27.16086,-15.08937";
var transform = "matrix(0.55081043,0,0,0.4748571,55.370899,45.933272)";

var url="http://localhost:8080/test4/polygon.svg";
fetch(url)
    .then(r=>r.blob())
    .then(b=>{
        svg_id.addEventListener('load',e=>URL.revokeObjectURL(svg_id.data));
        svg_id.data = URL.createObjectURL(b);
    });

svg_id.onload = e => {
    var polygon = document.createElementNS('http://www.w3.org/2000/svg','polygon');
    polygon.setAttribute('points',points);
    polygon.setAttribute('transform',transform);
    polygon.setAttribute('stoke-width','1');
    polygon.setAttribute('fill','green');

    svg_id.contentDocument.getElementById("layer1").appendChild(polygon);
    console.log(svg_id);
}